﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Serialization;

namespace WebUI.Models
{
    [Serializable]
    [XmlRoot("div")]
    public class TabelaDinamicaModel
    {
        public TabelaDinamicaModel(){}

        public TabelaDinamicaModel(string @class, string id, LinkTabelaModel link = null, List<ReferenciaDinamicaModel> referencias = null)
        {
            Class = @class;
            Id = id;
            Link = link;
            Referencias = referencias;
        }

        [XmlAttribute("class")]
        public string Class { get; set; }
        [XmlAttribute("id")]
        public string Id { get; set; }
        [XmlElement("a")]
        public LinkTabelaModel Link { get; set; }

        [XmlElement("div")]
        public List<ReferenciaDinamicaModel> Referencias { get; set; }
    }

    public class ReferenciaDinamicaModel
    {
        public ReferenciaDinamicaModel(){}

        public ReferenciaDinamicaModel(TabelaDinamicaModel tabela, string @class)
        {
            Tabela = tabela;
            Class = @class;
        }

        [XmlElement("div")]
        public TabelaDinamicaModel Tabela { get; set; }
        [XmlAttribute("class")]
        public string Class { get; set; }
    }

    public class LinkTabelaModel
    {
        public LinkTabelaModel() { }

        public LinkTabelaModel(string id, string @class, string onClick, string valor)
        {
            Id = id;
            Class = @class;
            OnClick = onClick;
            Valor = valor;
        }

        [XmlAttribute("class")]
        public string Class { get; set; }
        [XmlAttribute("id")]
        public string Id { get; set; }
        [XmlAttribute("onclick")]
        public string OnClick { get; set; }
        [XmlText()]
        public string Valor { get; set; }
    }
}